#pragma  once
#include "stdafx.h"
#define CONFIG_FILE_NAME "./res/default.config"

class Component;

class Config : public Component
{
public:
	typedef boost::shared_ptr<Config> sPtr;
	typedef boost::unordered_map<string,string> KeyMap;
	
	Config();
	~Config();
	void AddedToObject();
	void Initial();
	void SaveConfig(const Message&);
	inline bool GetBool(const string& str) const;
	inline unsigned int GetUINT(const string& str) const;
	inline string SetBool(bool);
	inline string SetUINT(unsigned int);
	bool ReadNextConfig(string& name, string& attr);

	KeyMap GetKeyControl();
	
	bool m_fullScreen;
	bool m_vsyncEnable;
	unsigned int m_screenWidth;
	unsigned int m_screenHeight;
	string m_resMap;

private:
	fstream m_configFile;
	KeyMap m_keyMap;

};